package util

import (
	"go.uber.org/zap"
	"os/exec"
)

func ExecRun(command string) error {
	t := exec.Command("bash", "-c", command)
	err := t.Run()
	zap.L().Debug("运行脚本", zap.Any("command", command))
	if err != nil {
		zap.L().Error("command err:"+command, zap.Error(err))
	}
	return err
}

func ExecOut(command string) (string, error) {
	t := exec.Command("bash", "-c", command)
	out, err := t.CombinedOutput()
	if err != nil {
		zap.L().Error("command:"+command+"out"+string(out), zap.Error(err))
	}
	return string(out), err
}
